home *** CD-ROM | disk | FTP | other *** search
/ Archive Magazine CD 1995 / Archive Magazine CD 1995.iso / discs / pipeline / abacus / p_line / Custom03 / c_Grading next >
Encoding:
Text File  |  1992-08-07  |  3.3 KB  |  299 lines

  1. %OP%VS4.13 (28-Apr-92), Gerald L Fitton, R4000 5966 9904 9938 
  2. %OP%TNN
  3. %OP%WRN
  4. %OP%DP0
  5. %OP%IRN
  6. %OP%PL0
  7. %OP%HM0
  8. %OP%FM0
  9. %OP%BM0
  10. %OP%LM4
  11. %OP%PT1
  12. %OP%PDPipeLine
  13. %OP%WC2,1242,44,628,0,1,0,6
  14. %OP%NDgrade_awarded,B10
  15. %OP%NDcomment_01,B32
  16. %OP%NDcomment_02,B53
  17. %OP%NDcode_table,C67C74
  18. %OP%NDcomment_table,D67D74
  19. %OP%NDinvalid_message,B54
  20. %OP%FR0,2
  21. %CO:A,38,72%Comments and Commands
  22.  
  23.  
  24.  
  25.  
  26.  
  27. %V%%L%function("grade","marks:number")
  28.  
  29. Declare all local variables as names
  30. %V%%L%set_name("grade_awarded",B10)
  31.  
  32. Test whether the data is valid (ie within range)
  33. If the data is invalid then exit from the custom function
  34.  returning an appropriate 'error message' to say why
  35. %V%%L%if(@marks>100,result("Over 100%PC%?"),)
  36. %V%%L%if(@marks<  0,result("Below 0%PC%?"),)
  37.  
  38. Find the grade from the mark using - if(condition,true,false) -
  39. Note that if the condition is 'false' then nothing is executed
  40. %V%%L%if(@marks<=100,set_value(grade_awarded,"Distinction -"),)
  41. %V%%L%if(@marks<  85,set_value(grade_awarded,"Merit -"),)
  42. %V%%L%if(@marks<  65,set_value(grade_awarded,"Pass -"),)
  43. %V%%L%if(@marks<  40,set_value(grade_awarded,"Fail -"),)
  44.  
  45. %V%%L%result(grade_awarded)
  46.  
  47. ------------------------------------------------------------------------
  48.  
  49. %V%%L%function("first_comment","code:text")
  50.  
  51. Declare all local variables as names
  52. %V%%L%set_name("comment_01",B32)
  53.  
  54. Set the local variable to a default value using set_value(name,value)
  55. %V%%L%set_value(comment_01,"Only codes 0 to 6 are valid")
  56.  
  57. %V%%L%if(@code="6",set_value(comment_01,"and perfect attendance"),)
  58. %V%%L%if(@code="5",set_value(comment_01,"and good attendance"),)
  59. %V%%L%if(@code="4",set_value(comment_01,"and poor attendance"),)
  60. %V%%L%if(@code="3",set_value(comment_01,"and bad attendance"),)
  61. %V%%L%if(@code="2",set_value(comment_01,"and rarely attends"),)
  62. %V%%L%if(@code="1",set_value(comment_01,"and very rarely attends"),)
  63. %V%%L%if(@code="0",set_value(comment_01,"and never attends"),)
  64.  
  65. %V%%L%result(comment_01)
  66.  
  67. ------------------------------------------------------------------------
  68. %V%%L%function("second_comment","code:text")
  69.  
  70. Declare all data and local variables as names
  71. %V%%L%set_name("code_table",   C67C74)
  72. %V%%L%set_name("comment_table",D67D74)
  73. %V%%L%set_name("comment_02",   B53)
  74. %V%%L%set_name("invalid_message",B54)
  75.  
  76. Use a lookup table to find the comment corresponding to the code
  77. %V%%L%set_value(comment_02,lookup(@code,code_table,comment_table))
  78.  
  79. Initialise the 'error message' variable with a default value
  80. %V%%L%set_value(invalid_message,"Use codes 0 to 6 only")
  81.  
  82. Use it to 'improve' the error message
  83. %V%%L%if(comment_02="Invalid",set_value(comment_02,invalid_message),)
  84.  
  85. %V%%L%result(comment_02)
  86.  
  87. Fixed data tables are placed in columns
  88.  to the right and after the custom function
  89.  This is so that rows may be added or deleted
  90.  from the custom function without losing data
  91.  or causing the tables to become 'ragged'
  92.  
  93.  
  94. Note: An 'invalid data' trap is part of a 'lookup' table
  95.  
  96. ------------------------------------------------------------------------
  97. %CO:B,23,0%%R%Value
  98.  
  99.  
  100.  
  101.  
  102.  
  103.  
  104.  
  105.  
  106. %V%%R%%LC%"Pass -"
  107.  
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128. %V%%R%"and good attendance"
  129.  
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136.  
  137.  
  138.  
  139.  
  140.  
  141.  
  142.  
  143.  
  144.  
  145.  
  146.  
  147.  
  148.  
  149. %V%%R%"Good"
  150. %V%%R%"Use codes 0 to 6 only"
  151. %CO:C,2,0%
  152.  
  153.  
  154.  
  155.  
  156.  
  157.  
  158.  
  159.  
  160.  
  161.  
  162.  
  163.  
  164.  
  165.  
  166.  
  167.  
  168.  
  169.  
  170.  
  171.  
  172.  
  173.  
  174.  
  175.  
  176.  
  177.  
  178.  
  179.  
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.  
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202.  
  203.  
  204.  
  205.  
  206.  
  207.  
  208.  
  209.  
  210.  
  211.  
  212.  
  213.  
  214.  
  215.  
  216.  
  217. %R%0
  218. %R%1
  219. %R%2
  220. %R%3
  221. %R%4
  222. %R%5
  223. %R%6
  224. ^#
  225. %CO:D,9,0%
  226.  
  227.  
  228.  
  229.  
  230.  
  231.  
  232.  
  233.  
  234.  
  235.  
  236.  
  237.  
  238.  
  239.  
  240.  
  241.  
  242.  
  243.  
  244.  
  245.  
  246.  
  247.  
  248.  
  249.  
  250.  
  251.  
  252.  
  253.  
  254.  
  255.  
  256.  
  257.  
  258.  
  259.  
  260.  
  261.  
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268.  
  269.  
  270.  
  271.  
  272.  
  273.  
  274.  
  275.  
  276.  
  277.  
  278.  
  279.  
  280.  
  281.  
  282.  
  283.  
  284.  
  285.  
  286.  
  287.  
  288.  
  289.  
  290.  
  291. Never
  292. Very rare
  293. Rare
  294. Bad
  295. Poor
  296. Good
  297. Perfect
  298. Invalid
  299.